package com.xoa.dev.jinOuWorkFlowWebService.util;

import java.util.Properties;

public class LoadConfig {


    private static LoadConfig loadConfig;


    public static LoadConfig initConfig(){
        if(loadConfig == null){
            loadConfig = new LoadConfig();
        }
        initPara();
        return loadConfig;
    }

    private static void initPara(){

        try{
            Properties prop = new Properties();
            prop.load(LoadConfig.class.getResourceAsStream("gd.properties"));
            GdPara.url = prop.get("group.url").toString();
            GdPara.u = prop.get("group.u").toString();
            GdPara.p = prop.get("group.p").toString();
            GdPara.ip = prop.get("group.ip").toString();
            GdPara.turl = prop.get("group.turl").toString();
            GdPara.field = prop.get("group.field").toString();
//            String path = LoadConfig.class.getResource("gd.properties").getPath();
//            is = new FileInputStream(path);
//            Properties properties = new Properties();
//            properties.load(is);
//            GdPara.url = properties.getProperty("group.url");
//            GdPara.u = properties.getProperty("group.u");
//            GdPara.p = properties.getProperty("group.p");
//            GdPara.ip = properties.getProperty("group.ip");
        }catch (Exception e){
            e.printStackTrace();
            throw new RuntimeException("Failed to get properties!");
        }

    }
}
